Skip to content

Comments

Added an example of defaults as styling without all fields is still#4

Open
darbysauter wants to merge 1 commit intoavdwerff:masterfrom
darbysauter:add_defaults
Open

Added an example of defaults as styling without all fields is still#4
darbysauter wants to merge 1 commit intoavdwerff:masterfrom
darbysauter:add_defaults

Conversation

@darbysauter
Copy link

valid and is parsed by Google Maps. The example in this case is
LineStyle which would not parse without ID, width, and color. I filled
in the defaults with the values from
https://developers.google.com/kml/documentation/kmlreference#linestyle

For the ID field I fill this in with the empty string and then when the
styles are looked up if the ID is null that is changed to an empty
string.

valid and is parsed by Google Maps. The example in this case is
LineStyle which would not parse without ID, width, and color. I filled
in the defaults with the values from
https://developers.google.com/kml/documentation/kmlreference#linestyle

For the ID field I fill this in with the empty string and then when the
styles are looked up if the ID is null that is changed to an empty
string.
@darbysauter
Copy link
Author

I am not sure if setting the ID to "" is a proper fix, this works in my case but if I understand the parser correctly this will just save the last style that was received. Really a good fix would be to give these a unique ID that matches up to the Placemark. But I could not think of a clean way of doing so.

Here is a snippet of the KML that I want to parse:

<Placemark> <Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style> <ExtendedData><SchemaData schemaUrl="#REMOVED"> <SimpleData name="Id">0</SimpleData> </SchemaData></ExtendedData> <LineString><coordinates>c0,c1 c2,c3</coordinates></LineString> </Placemark>

The KML is just a bunch of these repeated so if my understanding is correct even if it is just using the last color, that is fine for this case, but not for every case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant